<style lang="scss" scoped>
#cmain {
    .mainContent {
        min-height: 425px;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0px 0px 15px 0px rgba(207, 207, 207, 1);
        padding-top: 10px;
        padding: 0px 30px;
        .table-title {
            height: 54px;
            line-height: 54px;
            margin-bottom: 20px;
            font-size: 16px;
            font-weight: 800;
            color: rgba(102, 102, 102, 1);
            border-bottom: 1px solid #dcdfe6;
        }
        .el-input--mini .el-input__inner {
            width: 202px;
        }
        .smok-drink .el-input__inner {
            width: 100%;
        }
        #my-table-title {
            height: 50px;
            line-height: 50px;
            text-align: center;
            background: #eef1f6;
            font-size: 14px;
            color: #2b3245;
        }
        .MyMainTable {
            padding: 10px 0px;
            border-bottom: 1px solid #eef1f6;
            .el-col {
                text-align: center;
            }
            .el-icon-plus:before {
                color: #337aba;
                font-size: 20px;
                font-weight: 800;
                cursor: pointer;
            }
            .el-icon-minus:before {
                color: #e51c23;
                font-size: 20px;
                font-weight: 800;
                cursor: pointer;
            }
            .el-form-item--mini.el-form-item {
                margin-bottom: 1px !important;
            }
            .el-form-item--mini .el-form-item__content {
                margin-left: 0px !important;
            }
            .el-input--mini .el-input__inner {
                width: 100%;
            }
        }
    }
}
</style>

<template>
    <div id="cmain" class="family-tree-mask" v-loading="loading" element-loading-text="数据加载中，请稍等......">
        <div class="mainContent">

            <el-form ref="datas" :model="datas" size="mini" label-width="200px" label-position="left">
                <!--临床与治疗信息  -->
                <div class="table-title">临床与治疗信息</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="临床分期cTNM"></el-form-item>
                        <el-form-item label="T">
                            <el-select v-model="datas.t" @change="tnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in t_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="N">
                            <el-select v-model="datas.n" @change="tnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in n_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="M">
                            <el-select v-model="datas.m" @change="tnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in m_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="临床分期结果">
                            <div style="height40px;line-height40px;">{{datas.tnm_result}}</div>
                        </el-form-item>
                        <el-form-item label="病理分期pTNM"></el-form-item>
                        <el-form-item label="T">
                            <el-select v-model="datas.pt" @change="ptnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in pt_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="N">
                            <el-select v-model="datas.pn" @change="ptnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in pn_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="M">
                            <el-select v-model="datas.pm" @change="ptnm()">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item,index) in pm_data" :label="item" :value="item" :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="病理分期结果">
                            <div style="height40px;line-height40px;">{{datas.ptnm_result}}</div>
                        </el-form-item>
                        <el-form-item label="手术">
                            <el-select v-model="datas.operative_type">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="胃次全切除术" value="1"></el-option>
                                <el-option label="全胃切除术" value="2"></el-option>
                                <el-option label="近端胃切除术" value="3"></el-option>
                                <el-option label="预防性胃切除术" value="4"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="HER2">
                            <el-select v-model="datas.her2">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="阳性" value="1"></el-option>
                                <el-option label="阴性" value="2"></el-option>
                                <el-option label="意义不明确" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="幽门螺旋杆菌胃感染">
                            <el-radio-group v-model="datas.pylorus_spiral_bacillus">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="男性萎缩性胃炎">
                            <el-radio-group v-model="datas.male_atrophic_gastritis">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="巨大肥厚性胃炎">
                            <el-radio-group v-model="datas.ghg">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="食管胃结合部腺瘤Slewert分型">
                            <el-select v-model="datas.slewert">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="SlewertI型" value="1"></el-option>
                                <el-option label="SlewertII型" value="2"></el-option>
                                <el-option label="SlewertIII型" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否为弥漫型（印戒细胞）癌">
                            <el-radio-group v-model="datas.diffuse_type_cancer">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="化疗">
                            <el-radio-group v-model="datas.chemotherapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="放疗">
                            <el-radio-group v-model="datas.radiotherapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="免疫治疗">
                            <el-radio-group v-model="datas.immunological_therapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="药物名称" v-if="datas.immunological_therapy==1">
                            <el-input v-model="datas.it_drug_name"></el-input>
                        </el-form-item>
                        <el-form-item label="靶向治疗">
                            <el-radio-group v-model="datas.targeted_therapy">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="肠化生">
                            <el-radio-group v-model="datas.intestinal_metaplasia">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="恶性贫血">
                            <el-radio-group v-model="datas.pernicious_anemia">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- 遗传性肿瘤综合征表型信息 -->
                <div class="table-title">遗传性肿瘤综合征表型信息</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="胃肠道息肉">
                            <el-select v-model="datas.gi_polyps">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="腺瘤性息肉" value="1"></el-option>
                                <el-option label="幼年性息肉" value="2"></el-option>
                                <el-option label="黑斑性息肉" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="幼年性息肉病家族史" v-if="datas.gi_polyps==2">
                            <el-radio-group v-model="datas.juvenile_polyp_history">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="皮肤黏膜色素沉着过度" v-if="datas.gi_polyps==3">
                            <el-radio-group v-model="datas.hyperpigmentation">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="黑斑性息肉病家族史" v-if="datas.gi_polyps==3">
                            <el-radio-group v-model="datas.blackspot_family_history">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="诊断年龄">
                            <el-select v-model="datas.checkAge">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="＜40岁" value="1"></el-option>
                                <el-option label="≤50岁" value="2"></el-option>
                                <el-option label="＞50岁" value="3"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="息肉个数">
                            <el-input v-model="datas.number"></el-input>
                        </el-form-item>
                        <el-form-item label="息肉位置">
                            <el-select v-model="datas.location">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="靠近乙状结肠" value="1"></el-option>
                                <el-option label="直肠" value="2"></el-option>
                                <el-option label="结肠" value="3"></el-option>
                                <el-option label="胃部" value="4"></el-option>
                                <el-option label="整个胃肠道" value="5"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="儿童时期确诊为小脑共济失调">
                            <el-radio-group v-model="datas.cerebellar_ataxia">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="患多发性或双侧性先天性视网膜色素上皮肥大">
                            <el-radio-group v-model="datas.noRetina">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- 基因检测信息 -->
                <div class="table-title">基因检测信息</div>
                <div id="my-table-title">
                    <el-row display="flex" align="middle" justify="space-between">
                        <el-col span="3">操作</el-col>
                        <el-col span="4">基因</el-col>
                        <el-col span="4">转录本号</el-col>
                        <el-col span="4">变异位点</el-col>
                        <el-col span="3">检测类型</el-col>
                        <el-col span="3">功能改变</el-col>
                        <el-col span="3">突变类型</el-col>
                    </el-row>
                </div>

                <div class="MyMainTable" v-for="(item,index) in datas.results" :key="item.id">
                    <el-row>
                        <el-col span="3">
                            <i class="el-icon-plus" @click="addGenejcInfo(index)"></i>
                            <i class="el-icon-minus" @click="deleteGenejcInfo(index)"></i>
                        </el-col>
                        <el-col span="4">
                            <el-form-item>
                                <el-input v-model="item.detection_result_gene" placeholder="只能输入大写字母和数字"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label-width="0">
                                <el-input v-model="item.detection_result_trans" placeholder="请输入转录本号"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="4">
                            <el-form-item label-width="0">
                                <el-input v-model="item.detection_result_varia" placeholder="请输入变异位点"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.assay_type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="全基因组" value="1"></el-option>
                                    <el-option label="全外显子检测" value="2"></el-option>
                                    <el-option label="panel检测" value="3"></el-option>
                                    <el-option label="sanger测序" value="4"></el-option>
                                    <el-option label="MLPA" value="5"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.functional_change" v-show="item.functional_change != 6">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="错义突变" value="1"></el-option>
                                    <el-option label="无义突变" value="2"></el-option>
                                    <el-option label="移码突变" value="3"></el-option>
                                    <el-option label="同义突变" value="4"></el-option>
                                    <el-option label="剪接位点突变" value="5"></el-option>
                                    <el-option label="其他" value="6"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item v-if="item.functional_change==6" label-width="0">
                                <el-input v-model="item.other_function_change"></el-input>
                                <i class="el-icon-error" @click="shouFunctionalChange(index)"></i>
                            </el-form-item>
                        </el-col>
                        <el-col span="3">
                            <el-form-item label-width="0">
                                <el-select v-model="item.mutation_type">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option label="致病的" value="1"></el-option>
                                    <el-option label="可能致病的" value="2"></el-option>
                                    <el-option label="意义不明确的" value="3"></el-option>
                                    <el-option label="可能良性的" value="4"></el-option>
                                    <el-option label="良性的" value="5"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </div>

                <!-- 生活方式 -->
                <div class="table-title">生活方式</div>
                <el-row type="flex" justify="space-around">
                    <el-col :span="12" :offset="3">
                        <el-form-item label="吸烟">
                            <el-radio-group v-model="datas.smoking">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="吸烟频率" v-if="datas.smoking==1">
                            <el-row type="flex">
                                <el-col span="6">
                                    <el-input v-model="datas.smoking_cycle" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append"></template> -->
                                    </el-input>
                                    包/周&nbsp;&nbsp;X
                                </el-col>
                                <el-col span="12">
                                    <el-input v-model="datas.smoking_year" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append">年</template> -->
                                    </el-input>
                                    年
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="饮酒">
                            <el-radio-group v-model="datas.drink">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="饮酒频率" v-if="datas.drink==1">
                            <el-row type="flex">
                                <el-col span="12">
                                    <el-input v-model="datas.drink_cycle" style="width:50px;" class="smok-drink">
                                        <!-- <template slot="append">次/周</template> -->
                                    </el-input>
                                    次/周
                                </el-col>
                            </el-row>
                        </el-form-item>
                        <el-form-item label="高脂高红肉类饮食">
                            <el-radio-group v-model="datas.fatty_meat">
                                <el-radio label="1">是</el-radio>
                                <el-radio label="2">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="每日蔬菜摄入量">
                            <el-select v-model="datas.vegetable_consum">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="≥500mg" value="1"></el-option>
                                <el-option label="＜500mg" value="2"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="每日运动消耗量">
                            <el-select v-model="datas.dec">
                                <el-option label="请选择" value=""></el-option>
                                <el-option label="基本无运动量" value="1"></el-option>
                                <el-option label="30-50大卡" value="2"></el-option>
                                <el-option label="50-100大卡" value="3"></el-option>
                                <el-option label="100-200大卡" value="4"></el-option>
                                <el-option label="200-300大卡" value="5"></el-option>
                                <el-option label="＞300大卡" value="6"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="体重(kg)">
                            <el-input v-model="datas.weight" @change="getBmi"></el-input>
                        </el-form-item>
                        <el-form-item label="身高(cm)">
                            <el-input v-model="datas.height" @change="getBmi"></el-input>
                        </el-form-item>
                        <el-form-item label="BMI">
                            <div>{{ datas.bmi }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-card class="box-card footer-card">
                    <div slot="header" class="clearfix">
                        <Button style="float: right; margin-left:20px;" @click="onClose">取消</Button>
                        <Button type="primary" style="float: right;" @click="onSave">保存</Button>
                    </div>
                </el-card>

            </el-form>
        </div>
    </div>
</template>
<script>
import { getCookie } from "common/js/cookie.js";
import { familyTree } from "api/basic/familyTree/familyTree.js";
export default {
    name: "wa", //胃癌
    data() {
        return {
            t_data: [
                "TX",
                "T0",
                "Tis",
                "T1",
                "T1a",
                "T1b",
                "T2",
                "T3",
                "T4a",
                "T4b"
            ],
            n_data: ["NX", "N0", "N1", "N2", "N3", "N3a", "N3b"],
            m_data: ["M0", "M1"],
            pt_data: [
                "pTX",
                "pT0",
                "pTis",
                "pT1",
                "pT1a",
                "pT1b",
                "pT2",
                "pT3",
                "pT4",
                "pT4a",
                "pT4b"
            ],
            pn_data: ["pNX", "pN0", "pN1", "pN2", "pN3", "pN3a", "pN3b"],
            pm_data: ["pM0", "pM1"],
            datas: {
                t: "",
                n: "",
                m: "",
                tnm_result: "",
                pt: "",
                pn: "",
                pm: "",
                ptnm_result: "",
                operative_type: "", //手术类型
                immunological_therapy: "2", //免疫治疗
                it_drug_name: "", //免疫治疗具体信息
                radiotherapy: "2", //放疗
                blackspot_family_history: "2", //黑斑性息肉病家族史
                cerebellar_ataxia: "2", //儿童时期确诊为小脑共济失调
                hyperpigmentation: "2", //皮肤黏膜色素沉着过度
                targeted_therapy: "2", //是否进行靶向治疗
                her2: "",
                pylorus_spiral_bacillus: "2", //幽门螺旋杆菌胃感染
                male_atrophic_gastritis: "2", //男性萎缩性胃炎
                ghg: "2", //巨大肥厚性胃炎
                slewert: "", //食管胃结合部腺瘤Slewert分型
                diffuse_type_cancer: "2", //是否为弥漫型（印戒细胞）癌
                chemotherapy: "2", //化疗
                intestinal_metaplasia: "2", //肠化生
                pernicious_anemia: "2", //恶性贫血
                gi_polyps: "", //胃肠道息肉
                juvenile_polyp_history: "2", //幼年性息肉病家族史
                checkAge: "", //诊断年龄
                number: "", //息肉个数
                location: "", //息肉位置
                noRetina: "2", //患多发性或双侧性先天性视网膜色素上皮肥大
                results: [
                    {
                        assay_type: "",
                        detection_result_gene: "",
                        detection_result_trans: "",
                        detection_result_varia: "",
                        functional_change: "",
                        other_function_change: "",
                        mutation_type: ""
                    }
                ],
                smoking: "2",
                drink: "2",
                vegetable_consum: "",
                fatty_meat: "2",
                dec: "",
                drink_cycle: "",
                bmi: "",
                height: "",
                weight: "",
                smoking_cycle: "",
                smoking_year: ""
            },
            loading: true,
            postParams: {}
        };
    },
    computed: {},
    components: {},
    created() {},
    watch: {
        datas: {
            handler: function(newVal) {
                // 免疫治疗
                if (newVal.immunological_therapy != 1) {
                    this.datas.it_drug_name = "";
                }
                // 幼年性息肉病家族史
                if (newVal.gi_polyps != 2) {
                    this.datas.juvenile_polyp_history = "";
                }
                // 皮肤黏膜色素沉着过度/黑斑性息肉病家族史
                if (newVal.gi_polyps != 1) {
                    this.datas.hyperpigmentation = "";
                    this.datas.blackspot_family_history = "";
                }

                // 吸烟
                if (newVal.smoking != 1) {
                    this.datas.smoking_cycle = "";
                    this.datas.smoking_year = "";
                }
                // 饮酒
                if (newVal.drink != 1) {
                    this.datas.cut_tuboovarian_age = "";
                }
            },
            deep: true
        }
    },
    mounted() {
        document.title = "胃癌辅助信息";
        // 获取辅助信息
        this.postParams.userId = getCookie("userid");
        this.postParams.familyTreeId = M.url().familyTreeId;
        this.postParams.familyUserId = M.url().current_personid;
        this.postParams.cancerId = M.url().cancerId;
        familyTree
            .findOneFromCancer(this.postParams)
            .then(res => {
                if (res.returnCode == 0) {
                    if (res.data && res.data.familyCancer) {
                        this.datas = { ...res.data.familyCancer };
                        this.$Message.success("数据加载成功");
                    }
                } else {
                    this.$Message.error("数据加载失败");
                }
                this.loading = false;
            })
            .catch(error => {
                this.loading = false;
            });
    },
    methods: {
        onClose() {
            window.close();
        },
        onSave() {
            this.loading = true;
            this.postParams.familyCancer = this.datas;
            familyTree
                .saveOrUpdateCancerForm(this.postParams)
                .then(res => {
                    if (res.returnCode == 0) {
                        this.$Message.success("数据保存成功");
                    } else {
                        this.$Message.error("数据保存失败");
                    }
                    this.loading = false;
                })
                .catch(err => {
                    this.loading = false;
                });
        },
        tnm() {
            //
            this.ShowState(this.datas.t, this.datas.n, this.datas.m, 1);
        },
        ptnm() {
            this.ShowState(this.datas.pt, this.datas.pn, this.datas.pm, 2);
        },
        ShowState: function(t, n, m, type) {
            if (type == 1) {
                if (!t || !n || !m) {
                    this.datas.tnm_result = "无分期";
                    return;
                } else {
                    if (m == "M1" || m == "pM1") {
                        this.datas.tnm_result = t + n + m + "  IV期";
                    } else {
                        if (
                            (t == "T4a" && n == "N3") ||
                            (t == "T4a" && n == "N3a") ||
                            (t == "T4a" && n == "N3b") ||
                            ((t == "T4b" && n == "N3") ||
                                (t == "T4b" && n == "N3a") ||
                                (t == "T4b" && n == "N3b")) ||
                            (t == "T4b" && n == "N2") ||
                            (t == "T4b" && n == "pN2") ||
                            ((t == "pT4a" && n == "pN3") ||
                                (t == "pT4a" && n == "pN3a") ||
                                (t == "pT4a" && n == "pN3b")) ||
                            ((t == "pT4b" && n == "pN3") ||
                                (t == "pT4b" && n == "pN3a") ||
                                (t == "pT4b" && n == "pN3b") ||
                                (t == "pT4b" && n == "pN2"))
                        ) {
                            this.datas.tnm_result = t + n + m + " IIIC期";
                        } else if (
                            (t == "T4a" && n == "N2") ||
                            (t == "T4b" && n == "N0") ||
                            (t == "pT4b" && n == "pN0") ||
                            (t == "T3" && n == "N3") ||
                            (t == "T3" && n == "N3a") ||
                            (t == "T3" && n == "N3b") ||
                            (t == "T4a" && n == "N2a") ||
                            (t == "T4b" && n == "N1") ||
                            ((t == "pT4a" && n == "pN2") ||
                                (t == "pT3" && n == "pN3a") ||
                                (t == "pT3" && n == "pN3b") ||
                                (t == "pT3" && n == "pN3") ||
                                (t == "pT4a" && n == "pN2a") ||
                                (t == "pT4b" && n == "pN1"))
                        ) {
                            this.datas.tnm_result = t + n + m + "  IIIB期";
                        } else if (
                            (t == "T2" && n == "N3") ||
                            (t == "T2" && n == "N3a") ||
                            (t == "T2" && n == "N3b") ||
                            (t == "T3" && n == "N2") ||
                            (t == "T4a" && n == "N1") ||
                            ((t == "pT2" && n == "pN3") ||
                                (t == "pT2" && n == "pN3a") ||
                                (t == "pT2" && n == "pN3b") ||
                                (t == "pT3" && n == "pN2") ||
                                (t == "pT4a" && n == "pN1"))
                        ) {
                            this.datas.tnm_result = t + n + m + "  IIIA期";
                        } else if (
                            (t == "T1" && n == "N3") ||
                            (t == "T1" && n == "N3a") ||
                            (t == "T1" && n == "N3b") ||
                            (t == "T1a" && n == "N3") ||
                            (t == "T1a" && n == "N3a") ||
                            (t == "T1a" && n == "N3b") ||
                            (t == "T1b" && n == "N3") ||
                            (t == "T1b" && n == "N3a") ||
                            (t == "T1b" && n == "N3b") ||
                            (t == "T2" && n == "N2") ||
                            (t == "T3" && n == "N1") ||
                            (t == "T3" && n == "N1a") ||
                            (t == "T3" && n == "N1b") ||
                            (t == "T4a" && n == "N0") ||
                            ((t == "pT1" && n == "pN3") ||
                                (t == "pT1" && n == "pN3a") ||
                                (t == "pT1" && n == "pN3b") ||
                                (t == "pT1a" && n == "pN3") ||
                                (t == "pT1a" && n == "pN3a") ||
                                (t == "pT1a" && n == "pN3b") ||
                                (t == "pT1b" && n == "pN3") ||
                                (t == "pT1b" && n == "pN3a") ||
                                (t == "pT1b" && n == "pN3b") ||
                                (t == "pT2" && n == "pN2") ||
                                (t == "pT3" && n == "pN1") ||
                                (t == "pT3" && n == "pN1a") ||
                                (t == "pT3" && n == "pN1b") ||
                                (t == "pT4a" && n == "pN0"))
                        ) {
                            this.datas.tnm_result = t + n + m + "  IIB期";
                        } else if (
                            (t == "T1" && n == "N2") ||
                            (t == "T1a" && n == "N2") ||
                            (t == "T1b" && n == "N2") ||
                            (t == "T2" && n == "N1") ||
                            (t == "T3" && n == "N0") ||
                            ((t == "pT1" && n == "pN2") ||
                                (t == "pT1a" && n == "pN2") ||
                                (t == "pT1b" && n == "pN2") ||
                                (t == "pT2" && n == "pN1") ||
                                (t == "pT3" && n == "pN0"))
                        ) {
                            this.datas.tnm_result = t + n + m + "  IIA期";
                        } else if (
                            (t == "T1" && n == "N1") ||
                            (t == "T1a" && n == "N1") ||
                            (t == "T1b" && n == "N1") ||
                            (t == "T2" && n == "N0") ||
                            ((t == "pT1" && n == "pN1") ||
                                (t == "pT1a" && n == "pN1") ||
                                (t == "pT1b" && n == "pN1") ||
                                (t == "pT2" && n == "pN0"))
                        ) {
                            this.datas.tnm_result = t + n + m + "  1B期";
                        } else if (
                            (t == "T1" && n == "N0") ||
                            (t == "T1a" && n == "N0") ||
                            (t == "T1b" && n == "N0") ||
                            ((t == "pT1" && n == "pN0") ||
                                (t == "pT1a" && n == "pN0") ||
                                (t == "pT1b" && n == "pN0"))
                        ) {
                            this.datas.tnm_result = t + n + m + "  1A期";
                        } else if (
                            (t == "Tis" && n == "N0") ||
                            (t == "pTis" && n == "pN0")
                        ) {
                            this.datas.tnm_result = t + n + m + "  0期";
                        } else {
                            this.datas.tnm_result = "无分期";
                        }
                    }
                }
            } else {
                if (!t || !n || !m) {
                    this.datas.ptnm_result = "无分期";
                    return;
                } else {
                    if (m == "M1" || m == "pM1") {
                        this.datas.ptnm_result = t + n + m + "  IV期";
                    } else {
                        if (
                            (t == "T4a" && n == "N3") ||
                            (t == "T4a" && n == "N3a") ||
                            (t == "T4a" && n == "N3b") ||
                            ((t == "T4b" && n == "N3") ||
                                (t == "T4b" && n == "N3a") ||
                                (t == "T4b" && n == "N3b")) ||
                            (t == "T4b" && n == "N2") ||
                            (t == "T4b" && n == "pN2") ||
                            ((t == "pT4a" && n == "pN3") ||
                                (t == "pT4a" && n == "pN3a") ||
                                (t == "pT4a" && n == "pN3b")) ||
                            ((t == "pT4b" && n == "pN3") ||
                                (t == "pT4b" && n == "pN3a") ||
                                (t == "pT4b" && n == "pN3b") ||
                                (t == "pT4b" && n == "pN2"))
                        ) {
                            this.datas.ptnm_result = t + n + m + " IIIC期";
                        } else if (
                            (t == "T4a" && n == "N2") ||
                            (t == "T4b" && n == "N0") ||
                            (t == "pT4b" && n == "pN0") ||
                            (t == "T3" && n == "N3") ||
                            (t == "T3" && n == "N3a") ||
                            (t == "T3" && n == "N3b") ||
                            (t == "T4a" && n == "N2a") ||
                            (t == "T4b" && n == "N1") ||
                            ((t == "pT4a" && n == "pN2") ||
                                (t == "pT3" && n == "pN3a") ||
                                (t == "pT3" && n == "pN3b") ||
                                (t == "pT3" && n == "pN3") ||
                                (t == "pT4a" && n == "pN2a") ||
                                (t == "pT4b" && n == "pN1"))
                        ) {
                            this.datas.ptnm_result = t + n + m + "  IIIB期";
                        } else if (
                            (t == "T2" && n == "N3") ||
                            (t == "T2" && n == "N3a") ||
                            (t == "T2" && n == "N3b") ||
                            (t == "T3" && n == "N2") ||
                            (t == "T4a" && n == "N1") ||
                            ((t == "pT2" && n == "pN3") ||
                                (t == "pT2" && n == "pN3a") ||
                                (t == "pT2" && n == "pN3b") ||
                                (t == "pT3" && n == "pN2") ||
                                (t == "pT4a" && n == "pN1"))
                        ) {
                            this.datas.ptnm_result = t + n + m + "  IIIA期";
                        } else if (
                            (t == "T1" && n == "N3") ||
                            (t == "T1" && n == "N3a") ||
                            (t == "T1" && n == "N3b") ||
                            (t == "T1a" && n == "N3") ||
                            (t == "T1a" && n == "N3a") ||
                            (t == "T1a" && n == "N3b") ||
                            (t == "T1b" && n == "N3") ||
                            (t == "T1b" && n == "N3a") ||
                            (t == "T1b" && n == "N3b") ||
                            (t == "T2" && n == "N2") ||
                            (t == "T3" && n == "N1") ||
                            (t == "T3" && n == "N1a") ||
                            (t == "T3" && n == "N1b") ||
                            (t == "T4a" && n == "N0") ||
                            ((t == "pT1" && n == "pN3") ||
                                (t == "pT1" && n == "pN3a") ||
                                (t == "pT1" && n == "pN3b") ||
                                (t == "pT1a" && n == "pN3") ||
                                (t == "pT1a" && n == "pN3a") ||
                                (t == "pT1a" && n == "pN3b") ||
                                (t == "pT1b" && n == "pN3") ||
                                (t == "pT1b" && n == "pN3a") ||
                                (t == "pT1b" && n == "pN3b") ||
                                (t == "pT2" && n == "pN2") ||
                                (t == "pT3" && n == "pN1") ||
                                (t == "pT3" && n == "pN1a") ||
                                (t == "pT3" && n == "pN1b") ||
                                (t == "pT4a" && n == "pN0"))
                        ) {
                            this.datas.ptnm_result = t + n + m + "  IIB期";
                        } else if (
                            (t == "T1" && n == "N2") ||
                            (t == "T1a" && n == "N2") ||
                            (t == "T1b" && n == "N2") ||
                            (t == "T2" && n == "N1") ||
                            (t == "T3" && n == "N0") ||
                            ((t == "pT1" && n == "pN2") ||
                                (t == "pT1a" && n == "pN2") ||
                                (t == "pT1b" && n == "pN2") ||
                                (t == "pT2" && n == "pN1") ||
                                (t == "pT3" && n == "pN0"))
                        ) {
                            this.datas.ptnm_result = t + n + m + "  IIA期";
                        } else if (
                            (t == "T1" && n == "N1") ||
                            (t == "T1a" && n == "N1") ||
                            (t == "T1b" && n == "N1") ||
                            (t == "T2" && n == "N0") ||
                            ((t == "pT1" && n == "pN1") ||
                                (t == "pT1a" && n == "pN1") ||
                                (t == "pT1b" && n == "pN1") ||
                                (t == "pT2" && n == "pN0"))
                        ) {
                            this.datas.ptnm_result = t + n + m + "  1B期";
                        } else if (
                            (t == "T1" && n == "N0") ||
                            (t == "T1a" && n == "N0") ||
                            (t == "T1b" && n == "N0") ||
                            ((t == "pT1" && n == "pN0") ||
                                (t == "pT1a" && n == "pN0") ||
                                (t == "pT1b" && n == "pN0"))
                        ) {
                            this.datas.ptnm_result = t + n + m + "  1A期";
                        } else if (
                            (t == "Tis" && n == "N0") ||
                            (t == "pTis" && n == "pN0")
                        ) {
                            this.datas.ptnm_result = t + n + m + "  0期";
                        } else {
                            this.datas.ptnm_result = "无分期";
                        }
                    }
                }
            }
        },
        addGenejcInfo(index) {
            let obj = {
                detection_result_gene: "", //基因
                detection_result_trans: "", //转录本号
                detection_result_varia: "", //变异位点
                assay_type: "", //检测类型
                functional_change: "", //功能改变
                other_function_change: "", //其他
                mutation_type: "" //突变类型
            };
            ++index;
            this.datas.results.splice(index, 0, obj);
        },
        deleteGenejcInfo(index) {
            if (this.datas.results.length <= 1) {
                this.$Message.info("最少为一条，不可删除了");
                return;
            }
            this.datas.results.splice(index, 1);
        },
        shouFunctionalChange(index) {
            this.datas.results[index].functional_change = "";
            this.datas.results[index].other_function_change = "";
        },
        getBmi() {
            let bmi =
                Math.round(
                    this.datas.weight /
                        Math.pow(this.datas.height / 100, 2) *
                        100
                ) / 100;
            if (isNaN(bmi) || bmi == Infinity) {
                this.datas.bmi = "";
            } else {
                this.datas.bmi = bmi;
            }
        }
    }
};
</script>
 